﻿using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using NHibernate.Expression;
using Castle.ActiveRecord;
using Castle.Components.Validator;
using System.ComponentModel;
using Castle.ActiveRecord.Queries;
namespace Mang24k99.Model.PUBC
{
    [ActiveRecord(Table = "KT_PUBC_PRODUCT_History")]
    public partial class MKtPubcProductHistory : ActiveRecordBase
    {
        /// <summary>
        /// Deleteses the specified where.
        /// </summary>
        /// <param name="where">The where.</param>
        public static void Deletes(string where)
        {
            DeleteAll(typeof(MKtPubcProductHistory), where);
        }
        /// <summary>
        /// Deleteses the specified pk values.
        /// </summary>
        /// <param name="pkValues">The pk values.</param>
        public static void Deletes(System.Collections.IEnumerable pkValues)
        {
            DeleteAll(typeof(MKtPubcProductHistory), pkValues);
        }

        /// <summary>
        /// Selects all.
        /// </summary>
        /// <returns></returns>
        public static IList<MKtPubcProductHistory> SelectAll()
        {
            return (IList<MKtPubcProductHistory>)FindAll(typeof(MKtPubcProductHistory));
        }
        /// <summary>
        /// Selects all.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static IList<MKtPubcProductHistory> SelectAll(params ICriterion[] criteria)
        {
            return (IList<MKtPubcProductHistory>)FindAll(typeof(MKtPubcProductHistory), criteria);
        }
        /// <summary>
        /// Selects all.
        /// </summary>
        /// <param name="orders">The orders.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static IList<MKtPubcProductHistory> SelectAll(Order[] orders, params ICriterion[] criteria)
        {
            return (IList<MKtPubcProductHistory>)FindAll(typeof(MKtPubcProductHistory), orders, criteria);
        }
        /// <summary>
        /// Selects all.
        /// </summary>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <param name="orders">The orders.</param>
        /// <returns></returns>
        public static IList<MKtPubcProductHistory> SelectAll(DetachedCriteria detachedCriteria, params Order[] orders)
        {
            return (IList<MKtPubcProductHistory>)FindAll(typeof(MKtPubcProductHistory), detachedCriteria, orders);
        }


        /// <summary>
        /// Selects all query.
        /// </summary>
        /// <param name="query">The query.</param>
        /// <returns></returns>
        [DataObjectMethod(DataObjectMethodType.Select)]
        public static IList<MKtPubcProductHistory> SelectAllQuery(SimpleQuery query)
        {
            return (IList<MKtPubcProductHistory>)ExecuteQuery(query);
        }


        /// <summary>
        /// Selects the by primary key.
        /// </summary>
        /// <param name="ID">The ID.</param>
        /// <returns></returns>
        public static MKtPubcProductHistory SelectByPrimaryKey(object ID)
        {
            return (MKtPubcProductHistory)FindByPrimaryKey(typeof(MKtPubcProductHistory), ID, false);
        }

        /// <summary>
        /// Selects the by primary key.
        /// </summary>
        /// <param name="ID">The ID.</param>
        /// <returns></returns>
        public static MKtPubcProductHistory SelectOne(DetachedCriteria detachedCriteria)
        {
            return (MKtPubcProductHistory)FindOne(typeof(MKtPubcProductHistory), detachedCriteria);
        }
        /// <summary>
        /// Selects the one.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static MKtPubcProductHistory SelectOne(params ICriterion[] criteria)
        {
            return (MKtPubcProductHistory)FindOne(typeof(MKtPubcProductHistory), criteria);
        }

        /// <summary>
        /// Selects the first.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static MKtPubcProductHistory SelectFirst(params ICriterion[] criteria)
        {
            return (MKtPubcProductHistory)FindFirst(typeof(MKtPubcProductHistory), criteria);
        }
        /// <summary>
        /// Selects the first.
        /// </summary>
        /// <param name="orders">The orders.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static MKtPubcProductHistory SelectFirst(Order[] orders, params ICriterion[] criteria)
        {
            return (MKtPubcProductHistory)FindFirst(typeof(MKtPubcProductHistory), orders, criteria);
        }
        /// <summary>
        /// Selects the first.
        /// </summary>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <param name="orders">The orders.</param>
        /// <returns></returns>
        public static MKtPubcProductHistory SelectFirst(DetachedCriteria detachedCriteria, Order[] orders)
        {
            return (MKtPubcProductHistory)FindFirst(typeof(MKtPubcProductHistory), detachedCriteria, orders);

        }

        /// <summary>
        /// Selects the ALL by property.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        public static IList<MKtPubcProductHistory> SelectALLByProperty(string property, object value)
        {
            return (IList<MKtPubcProductHistory>)FindAllByProperty(typeof(MKtPubcProductHistory), property, value);
        }
        /// <summary>
        /// Selects the ALL by property.
        /// </summary>
        /// <param name="orderByColumn">The order by column.</param>
        /// <param name="property">The property.</param>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        public static IList<MKtPubcProductHistory> SelectALLByProperty(string orderByColumn, string property, object value)
        {
            return (IList<MKtPubcProductHistory>)FindAllByProperty(typeof(MKtPubcProductHistory), orderByColumn, property, value);
        }

        /// <summary>
        /// Selects the ALL sliced.
        /// </summary>
        /// <param name="firstResult">The first result.</param>
        /// <param name="maxResult">The max result.</param>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <returns></returns>
        public static IList<MKtPubcProductHistory> SelectALLSliced(int firstResult, int maxResult, DetachedCriteria detachedCriteria)
        {
            return (IList<MKtPubcProductHistory>)SlicedFindAll(typeof(MKtPubcProductHistory), firstResult, maxResult, detachedCriteria);
        }
        /// <summary>
        /// Selects the ALL sliced.
        /// </summary>
        /// <param name="firstResult">The first result.</param>
        /// <param name="maxResult">The max result.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static IList<MKtPubcProductHistory> SelectALLSliced(int firstResult, int maxResult, params ICriterion[] criteria)
        {
            return (IList<MKtPubcProductHistory>)SlicedFindAll(typeof(MKtPubcProductHistory), firstResult, maxResult, criteria);
        }
        /// <summary>
        /// Selects the ALL sliced.
        /// </summary>
        /// <param name="firstResult">The first result.</param>
        /// <param name="maxResult">The max result.</param>
        /// <param name="orders">The orders.</param>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <returns></returns>
        public static IList<MKtPubcProductHistory> SelectALLSliced(int firstResult, int maxResult, Order[] orders, DetachedCriteria detachedCriteria)
        {
            return (IList<MKtPubcProductHistory>)SlicedFindAll(typeof(MKtPubcProductHistory), firstResult, maxResult, orders, detachedCriteria);
        }
        /// <summary>
        /// Selects the ALL sliced.
        /// </summary>
        /// <param name="firstResult">The first result.</param>
        /// <param name="maxResult">The max result.</param>
        /// <param name="orders">The orders.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static IList<MKtPubcProductHistory> SelectALLSliced(int firstResult, int maxResult, Order[] orders, params ICriterion[] criteria)
        {
            return (IList<MKtPubcProductHistory>)SlicedFindAll(typeof(MKtPubcProductHistory), firstResult, maxResult, orders, criteria);
        }

        /// <summary>
        /// Countses this instance.
        /// </summary>
        /// <returns></returns>
        public static int Counts()
        {
            return Count(typeof(MKtPubcProductHistory));
        }
        /// <summary>
        /// Countses the specified detached criteria.
        /// </summary>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <returns></returns>
        public static int Counts(DetachedCriteria detachedCriteria)
        {
            return Count(typeof(MKtPubcProductHistory), detachedCriteria);
        }
        /// <summary>
        /// Countses the specified criteria.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static int Counts(params ICriterion[] criteria)
        {
            return Count(typeof(MKtPubcProductHistory), criteria);
        }


        /// <summary>
        /// Exists the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public static bool Exist(object id)
        {
            return Exists(typeof(MKtPubcProductHistory), id);
        }
        /// <summary>
        /// Exists the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <returns></returns>
        public static bool Exist(DetachedCriteria detachedCriteria)
        {
            return Exists(typeof(MKtPubcProductHistory), detachedCriteria);
        }
        /// <summary>
        /// Exists the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static bool Exist(params ICriterion[] criteria)
        {
            return Exists(typeof(MKtPubcProductHistory), criteria);
        }
        protected override void OnDelete()
        {
            DeleteTime = DateTime.Now;
            base.OnDelete();
        }





        /// <summary>
        /// Gets or sets the ID.(ID)
        /// </summary>
        /// <value>The ID.</value>
        /// <remarks>
        /// ID
        /// </remarks>
        [PrimaryKey(PrimaryKeyType.Native, "ID"),
        ValidateNonEmpty("ID不能为空"),
        ValidateRange(0, 2147483647, "ID的值要在0到2147483647之间"),
        ]
        public int? ID
        {
            get
            {
                return _ID;
            }
            set
            {
                _ID = value;
            }
        }


        /// <summary>
        /// Gets or sets the BoardNO.(BoardNO)
        /// </summary>
        /// <value>The BoardNO.</value>
        /// <remarks>
        /// BoardNO
        /// </remarks>
        [Property("BOARD_NO"),
        ValidateRange(0, 2147483647, "BoardNO的值要在0到2147483647之间"),
        ]
        public int? BoardNO
        {
            get
            {
                return _BoardNO;
            }
            set
            {
                _BoardNO = value;
            }
        }


        /// <summary>
        /// Gets or sets the BoardName.(BoardName)
        /// </summary>
        /// <value>The BoardName.</value>
        /// <remarks>
        /// BoardName
        /// </remarks>
        [Property("BOARD_NAME"),
        ValidateLength(1, 120, "BoardName长度必须在1到120之间"),
        ]
        public string BoardName
        {
            get
            {
                return _BoardName;
            }
            set
            {
                _BoardName = value;
            }
        }


        /// <summary>
        /// Gets or sets the BoardAlias.(BoardAlias)
        /// </summary>
        /// <value>The BoardAlias.</value>
        /// <remarks>
        /// BoardAlias
        /// </remarks>
        [Property("BOARD_ALIAS"),
        ValidateLength(1, 30, "BoardAlias长度必须在1到30之间"),
        ]
        public string BoardAlias
        {
            get
            {
                return _BoardAlias;
            }
            set
            {
                _BoardAlias = value;
            }
        }


        /// <summary>
        /// Gets or sets the CycNum.(CycNum)
        /// </summary>
        /// <value>The CycNum.</value>
        /// <remarks>
        /// CycNum
        /// </remarks>
        [Property("CYC_NUM"),
        ValidateRange(0, 2147483647, "CycNum的值要在0到2147483647之间"),
        ]
        public int? CycNum
        {
            get
            {
                return _CycNum;
            }
            set
            {
                _CycNum = value;
            }
        }


        /// <summary>
        /// Gets or sets the IsValidate.(IsValidate)
        /// </summary>
        /// <value>The IsValidate.</value>
        /// <remarks>
        /// IsValidate
        /// </remarks>
        [Property("IS_VALIDATE"),
        ValidateRange(0, 2147483647, "IsValidate的值要在0到2147483647之间"),
        ]
        public int? IsValidate
        {
            get
            {
                return _IsValidate;
            }
            set
            {
                _IsValidate = value;
            }
        }


        /// <summary>
        /// Gets or sets the InputTime.(InputTime)
        /// </summary>
        /// <value>The InputTime.</value>
        /// <remarks>
        /// InputTime
        /// </remarks>
        [Property("INPUT_TIME"),
        ]
        public DateTime? InputTime
        {
            get
            {
                return _InputTime;
            }
            set
            {
                _InputTime = value;
            }
        }


        /// <summary>
        /// Gets or sets the ModifyTime.(ModifyTime)
        /// </summary>
        /// <value>The ModifyTime.</value>
        /// <remarks>
        /// ModifyTime
        /// </remarks>
        [Property("MODIFY_TIME"),
        ]
        public DateTime? ModifyTime
        {
            get
            {
                return _ModifyTime;
            }
            set
            {
                _ModifyTime = value;
            }
        }


        /// <summary>
        /// Gets or sets the DeleteTime.(DeleteTime)
        /// </summary>
        /// <value>The DeleteTime.</value>
        /// <remarks>
        /// DeleteTime
        /// </remarks>
        [Property("DELETE_TIME"),
        ]
        public DateTime? DeleteTime
        {
            get
            {
                return _DeleteTime;
            }
            set
            {
                _DeleteTime = value;
            }
        }



        private int? _ID;

        private int? _BoardNO;

        private string _BoardName;

        private string _BoardAlias;

        private int? _CycNum;

        private int? _IsValidate;

        private DateTime? _InputTime;

        private DateTime? _ModifyTime;

        private DateTime? _DeleteTime;


    }
}
